<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> --%>
<%
	String path = request.getContextPath();
	//获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量    
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="email=no" />
<meta name="viewport" content="width=device-width,target-densitydpi=device-dpi,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />

	<title>BD新增</title>
<link href="css/iphonecss/iphonecss.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
</head>

<body style="background:#f0f0f0">
<h2>BD总结<a href="javascript:void(0)" onclick="returnback()" class="return"></a></h2>
	
    <div class="rongqi">
    	<em>时间</em><input id="workTime" type="text" value="" class="c-333">
    </div>
    <div class="rongqi">
    	<em>事项</em><span id="shixiang_qita"  id="workType" onclick="shixiangOnclick(this)">其它</span><span onclick="shixiangOnclick(this)" id="shixiang_kuaidiyuanshiwu">快递员事务</span><span id="shixiang_qiyeqiatan" onclick="shixiangOnclick(this)">企业洽谈</span><span id="shixiang_saolou" onclick="shixiangOnclick(this)">扫楼＋地推</span>
    	<input type="hidden" id="select_shixiang">
    </div>
    <div class="rongqi">
    	<em>过程说明</em><div style="padding-left:7rem;padding-top:0.5rem"><textarea id="workDetail" class="textarea c-333" rows="1" name="S1" cols="27" onscroll="this.rows++;"></textarea> </div>
    </div>
    <div class="rongqi">
    	<em>结果展示</em><div style="padding-left:7rem;padding-top:0.5rem"><textarea id="workResult" class="textarea c-333" rows="1" name="S1" cols="27" onscroll="this.rows++;"></textarea> </div>
    </div>
     <div class="rongqi">
    	<em>备注</em><div style="padding-left:7rem;padding-top:0.5rem"><textarea id="content" class="textarea c-333" rows="1" name="S1" cols="27" onscroll="this.rows++;"></textarea> </div>
    </div>
    <div style="padding:0 1rem"><button class="but" onclick="addDaily()">提 交</button></div>
</body>
<script type="text/javascript">

function shixiangOnclick(obj){
	switch(obj.id){
	case "shixiang_qita":
		$("#shixiang_kuaidiyuanshiwu").removeClass(); 
		$("#shixiang_qiyeqiatan").removeClass(); 
		$("#shixiang_saolou").removeClass(); 
		$("#shixiang_qita").removeClass().addClass("xz"); 
		break;
	case "shixiang_kuaidiyuanshiwu":
		$("#shixiang_kuaidiyuanshiwu").removeClass().addClass("xz"); 
		$("#shixiang_qiyeqiatan").removeClass(); 
		$("#shixiang_saolou").removeClass(); 
		$("#shixiang_qita").removeClass(); 
		break;
	case "shixiang_qiyeqiatan":
		$("#shixiang_kuaidiyuanshiwu").removeClass(); 
		$("#shixiang_qiyeqiatan").removeClass().addClass("xz"); 
		$("#shixiang_saolou").removeClass(); 
		$("#shixiang_qita").removeClass(); 
		break;
	case "shixiang_saolou":
		$("#shixiang_kuaidiyuanshiwu").removeClass(); 
		$("#shixiang_qiyeqiatan").removeClass(); 
		$("#shixiang_saolou").removeClass().addClass("xz"); 
		$("#shixiang_qita").removeClass(); 
		break;
	}
	$("#select_shixiang").val(obj.innerHTML);
}

function returnback(){
	history.back();
}

var tijiaoclick=true;
function addDaily(){
	tijiaoclick=false;
	var workTime=$("#workTime").val();
	var workType=$("#select_shixiang").val();
	var workDetail=$("#workDetail").val();
	var workResult=$("#workResult").val();
	var content=$("#content").val();
	
	if(workTime==""){
		alert("时间不能为空");
		return;
	}else if(workType==""){
		alert("事项不能为空");
		return;
	}else if(workDetail==""){
		alert("过程说明不能为空");
		return;
	}else if(workResult==""){
		alert("结果不能为空");
		return;
	}else if(content==""){
		alert("备注不能为空");
		return;
	}
	 $.ajax({
		 type :'POST',
		 data:{workTime:workTime,workType:workType,workDetail:workDetail,workResult:workResult,content:content},
		 url :'<%=basePath%>addDailyAction.action',
		 success : function(data){
			 if(data=="true"){
					tijiaoclick=true;
				 location.href="toListDailyAction.action";
			 }else{
					tijiaoclick=true;
				 alert("已超时,请重新登陆");	 
			 }
		}
	}); 
}


</script>
</html>